home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / mod2tutb.zip / DIRHELPS.DEF < prev    next >
Text File  |  1989-01-18  |  4KB  |  89 lines

  1. DEFINITION MODULE DirHelps;
  2.  
  3. (*            Copyright (c) 1987, 1989 - Coronado Enterprises    *)
  4.  
  5. EXPORT QUALIFIED ReadFileStats,
  6.                  GetDiskStatistics,
  7.                  ChangeToDirectory,
  8.                  CopyFile,
  9.                  FileDataPointer,
  10.                  FileData;
  11.  
  12.  
  13. TYPE FileDataPointer = POINTER TO FileData;
  14.      FileData = RECORD
  15.         Name  : ARRAY[0..13] OF CHAR;
  16.         Attr  : CARDINAL;
  17.         Time  : CARDINAL;
  18.         Date  : CARDINAL;
  19.         Size  : REAL;
  20.         Left  : FileDataPointer;
  21.         Right : FileDataPointer;
  22.      END;
  23.  
  24.  
  25.  
  26. (*******************************************************************)
  27. PROCEDURE ReadFileStats(FileName      : ARRAY OF CHAR;
  28.                         FirstFile     : BOOLEAN;
  29.                         VAR FilePt    : FileDataPointer;
  30.                         VAR FileError : BOOLEAN);
  31.  
  32. (* This procedure is used to read the DOS data concerning a file.  *)
  33. (* It returns a pointer to the FileData structure containing all   *)
  34. (* of the file data.  FirstFile is set to TRUE for the first file  *)
  35. (* and to FALSE for the remaining files in the list.  FileError    *)
  36. (* returns TRUE if the read was successful and FALSE if it was not *)
  37. (* with a FALSE also indicating the end of the files in this dir-  *)
  38. (* ectory.                                                         *)
  39.  
  40.  
  41.  
  42. (*******************************************************************)
  43. PROCEDURE GetDiskStatistics(Drive                 : CHAR;
  44.                             VAR SectorsPerCluster : CARDINAL;
  45.                             VAR FreeClusters      : CARDINAL;
  46.                             VAR BytesPerSector    : CARDINAL;
  47.                             VAR TotalClusters     : CARDINAL);
  48.  
  49. (* This procedure gets the disk statistics on the selected drive.  *)
  50.  
  51.  
  52.  
  53. (*******************************************************************)
  54. PROCEDURE ChangeToDirectory(Directory : ARRAY OF CHAR;
  55.                             CreateIt : BOOLEAN;
  56.                             VAR ErrorReturn : BOOLEAN);
  57.  
  58. (* C:\DIR1\DIR2\DIR3\<000>   Example of usage                      *)
  59. (* This procedure is used to change to a directory on the selected *)
  60. (* drive included in the CHAR array. The directory is a complete   *)
  61. (* path and if the CreatIt flag is TRUE, the directory will be     *)
  62. (* created, otherwise an error return will be generated as follows.*)
  63. (* ErrorReturn = 0  Directory created as desired.                  *)
  64. (* ErrorReturn = 1  Directory doesn't exist and CreateIt = FALSE.  *)
  65. (* ErrorReturn = 2  Not enough disk room to create Directory.      *)
  66.  
  67.  
  68.  
  69. (*******************************************************************)
  70. PROCEDURE CopyFile(SourceFile       : ARRAY OF CHAR;
  71.                    DestinationFile  : ARRAY OF CHAR;
  72.                    FileSize         : REAL;
  73.                    VAR ResultOfCopy : CARDINAL);
  74.  
  75. (* C:FILENAME.EXT<000>   Example of usage                          *)
  76. (* This procedure copies a file from SourceDrive:SourceFile to     *)
  77. (* DestinationDrive:DestinationFile and returns a ResultOfCopy     *)
  78. (* indicator to signal the result of the copy.  It assumes that    *)
  79. (* the proper subdirectory has been selected prior to a call to    *)
  80. (* this routine.  If a file cannot be opened, it is not copied.    *)
  81.  
  82. (* ResultOfCopy = 0  Good copy made.                               *)
  83. (* ResultOfCopy = 1  Cannot open source file.                      *)
  84. (* ResultOfCopy = 2  Cannot open destination file.                 *)
  85. (* ResultOfCopy = 3  Not enough room on the disk.                  *)
  86.  
  87.  
  88. END DirHelps.
  89.